package com.zjw.vo;

import com.zjw.constant.ResultCodeEnum;
import lombok.Data;

/**
 * <h1>通用返回</h1>
 *
 * @author zjw
 * @date 2020/09/06
 */
@Data
public class ResultVO<T> {

    /***
     * 状态码
     */
    private Integer code;

    /***
     * 消息
     */
    private String msg;

    /***
     * 返回对象
     */
    private T data;

    public ResultVO(ResultCodeEnum resultCodeEnum) {
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMessage();
    }

    public ResultVO(ResultCodeEnum resultCodeEnum, T data) {
        this.code = resultCodeEnum.getCode();
        this.msg = resultCodeEnum.getMessage();
        this.data = data;
    }

    public ResultVO(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultVO() {
    }
}
